﻿IF EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'Lit_OT' AND COLUMN_NAME = 'Cromacheck')
  ALTER TABLE Lit_OT DROP COLUMN Cromacheck
GO

IF EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'Lit_OT' AND COLUMN_NAME = 'TamanoFinal')
  ALTER TABLE Lit_OT ALTER COLUMN TamanoFinal VARCHAR(100) NULL
GO

IF  EXISTS (SELECT * FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE WHERE TABLE_NAME = 'Lit_OTMaterialCotizado' AND CONSTRAINT_NAME = 'FK_Lit_OTMaterialCotizado_Lit_OT')
	ALTER TABLE [dbo].[Lit_OTMaterialCotizado] DROP CONSTRAINT [FK_Lit_OTMaterialCotizado_Lit_OT]
GO

/****** Object:  Table [dbo].[Lit_OTMaterialCotizado]    Script Date: 06/05/2011 20:38:46 ******/
IF  EXISTS (SELECT * FROM information_schema.tables WHERE TABLE_TYPE = 'BASE TABLE' AND TABLE_NAME = 'Lit_OTMaterialCotizado')
	DROP TABLE [dbo].[Lit_OTMaterialCotizado]
GO

CREATE TABLE [dbo].[Lit_OTMaterialCotizado](
	[Id] [int] IDENTITY(1,1) NOT NULL,
	[OTId] [int] NULL,
	[Material] [varchar](255) NULL,
	[Papel] [varchar](13) NULL,
	[TamanoPliegoMaterial] [varchar](50) NULL,
	[TamanoPliegoPrensa] [varchar](50) NULL,
	[Cantidad] [decimal](10, 2) NULL,
	[Aumento] [decimal](10, 2) NULL,
	[PliegosTotal] [decimal](10, 2) NULL,
	[Montaje] [DECIMAL] (10,2) NULL,
	[PliegosPrensaTotal] [decimal](10, 2) NULL,
	[NoCotizado] [decimal](10, 2) NULL
) ON [PRIMARY]

GO

SET ANSI_PADDING OFF
GO

ALTER TABLE [dbo].[Lit_OTMaterialCotizado] WITH CHECK ADD  CONSTRAINT [FK_Lit_OTMaterialCotizado_Lit_OT] FOREIGN KEY([OTId])
REFERENCES [dbo].[Lit_OT] ([Id])
GO

ALTER TABLE [dbo].[Lit_OTMaterialCotizado] CHECK CONSTRAINT [FK_Lit_OTMaterialCotizado_Lit_OT]
GO